Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PECO power outage counter integration #65194

Merged
merged 40 commits into from
Mar 21, 2022

Conversation

IceBotYT
Copy link
Contributor

@IceBotYT IceBotYT commented Jan 29, 2022

Proposed change

I want to add a new PECO integration that counts the power outages in a user's area.
PECO is the energy company for the Philadelphia and Philadelphia metro.
Learn more here

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@IceBotYT
Copy link
Contributor Author

IceBotYT commented Jan 29, 2022

I had to revert the first two commits because I closed the other PR for that integration and forgot to push the delete commits.
Please remove the nws_alerts integration label!
Sorry! :/

@IceBotYT
Copy link
Contributor Author

Want me to fix the "method could be a function error"?

@IceBotYT
Copy link
Contributor Author

Anything I need to do at the moment @farmio?

@farmio
Copy link
Contributor

farmio commented Jan 30, 2022

Want me to fix the "method could be a function error"?

Yes sure CI should be green.
Also add all untested files to .coveragerc. Except for config_flow.py - it should have 100% test coverage.

Then you will have to be patient until a member reviews your code. Consider adding tests or type annotations meanwhile - this makes it easier to review.
And please don't tag people unless you have to - same for discord.

@IceBotYT
Copy link
Contributor Author

Ah I see. It's looking for the wrong error. Didn't know voluptuous did that!

@IceBotYT
Copy link
Contributor Author

Idk if you get e-mails for new commits, but I fixed the MultipleValid error and added some more type definitions

@IceBotYT
Copy link
Contributor Author

IceBotYT commented Jan 30, 2022

????????????
I try to commit with regular dict and it says to use typing.Dict, and now the CI here is saying to use dict instead????

I guess I'll use regular dict if that's what pylint wants

@IceBotYT
Copy link
Contributor Author

Here's a screenshot from the commit command

typing.Dict is recommended

Copy link
Contributor

@farmio farmio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are serious about typing try adding your integration to .strict_typing https://github.com/home-assistant/core/blob/dev/.strict-typing and run mypy again.

homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
@farmio
Copy link
Contributor

farmio commented Jan 30, 2022

Type hinting generics in standard collections was added in Python 3.9. Maybe you are using outdated mypy or run it with older Python.

Idk if you get e-mails for new commits

Good grief, I'm not 😱
If you encounter issues with integration development check out the dedicated channels at the HA discord server. And please always run checks locally before pushing - this saves a lot of time for you and a reviewer.

@IceBotYT IceBotYT requested a review from farmio March 15, 2022 20:25
Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments.
Seems also the deletion of translation files from the update integration came into this PR?!

homeassistant/components/peco/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/peco/strings.json Outdated Show resolved Hide resolved
homeassistant/components/peco/translations/en.json Outdated Show resolved Hide resolved
@IceBotYT
Copy link
Contributor Author

Done!

@IceBotYT IceBotYT changed the title Create new PECO integration Create new PECO power outage counter integration Mar 18, 2022
Copy link
Contributor

@farmio farmio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some final suggestions. Other than that I think its ready to go 👍

as gjohansson-ST mentioned: Seems the deletion of translation files from the update integration came into this PR.

homeassistant/components/peco/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/peco/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/peco/sensor.py Outdated Show resolved Hide resolved
@ggravlingen
Copy link
Contributor

A much better title and description than before of this PR 🌟

@IceBotYT
Copy link
Contributor Author

I didn't change any dependencies, how do I fix the conflict?

@ggravlingen
Copy link
Contributor

I didn't change any dependencies, how do I fix the conflict?

Try pinning the version here to the same version as in home assistant and see if it’s helps: https://github.com/IceBotYT/peco-outage-api/blob/9850a9682ca90d8b8ec1d5c33c5e26020b7e306e/setup.cfg#L23

@ggravlingen
Copy link
Contributor

It’s generally considered good practice to pin versions of dependencies to avoid unwanted updates of dependencies’ dependencies, and to avoid security issues.

@gjohansson-ST
Copy link
Member

I didn't change any dependencies, how do I fix the conflict?

The pip errors are not related to this PR (I have same on one of my PR's). I think someone from core team needs to fix something.

@ggravlingen
Copy link
Contributor

I didn't change any dependencies, how do I fix the conflict?

The pip errors are not related to this PR (I have same on one of my PR's). I think someone from core team needs to fix something.

I still recommend pinning the version though.

Merging to fix dependency conflict upstream to make CI pass
Copy link
Contributor

@farmio farmio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! 👍

Dev automation moved this from Review in progress to Reviewer approved Mar 20, 2022
Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@farmio farmio changed the title Create new PECO power outage counter integration Add PECO power outage counter integration Mar 21, 2022
@farmio farmio merged commit a43505a into home-assistant:dev Mar 21, 2022
Dev automation moved this from Reviewer approved to Done Mar 21, 2022
@IceBotYT IceBotYT deleted the peco-outage-count branch March 21, 2022 23:22
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there @IceBotYT 👋

Please address these comments in a new PR.

Thanks! 👍

homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/strings.json Show resolved Hide resolved
homeassistant/components/peco/strings.json Show resolved Hide resolved
tests/components/peco/test_sensor.py Show resolved Hide resolved
tests/components/peco/test_sensor.py Show resolved Hide resolved
homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/config_flow.py Show resolved Hide resolved
homeassistant/components/peco/config_flow.py Show resolved Hide resolved
@IceBotYT IceBotYT restored the peco-outage-count branch March 22, 2022 16:48
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2022
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments in a new PR. Thanks!

homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/sensor.py Show resolved Hide resolved
homeassistant/components/peco/sensor.py Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants